<?php

namespace App\Requests\Api\Users;

use Illuminate\Foundation\Http\FormRequest;

/**
 * 新增字段校验
 * Class StoreRequest
 * @package App\Requests\Api\Users
 */
class StoreRequest extends FormRequest {
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'username'    => 'required',
            'contacts'   => 'required',
            'birthday'    => 'required|string',
            'invitation_code'   => 'required|string',
            'gender'    => 'required|integer',
            'school_id'   => 'required|integer',
            'telephone'   => 'required|integer',
        ];
    }

    public function messages()
    {
        return [
            'username.required'    => 'username is required',
            'contacts'       => 'contacts is required',
            'school_id.integer'  => 'school_id is integer',
            'school_id.required'  => 'school_id is required',
            'gender.required'  => 'gender is required',
            'gender.integer'  => 'gender is integer',
            'telephone.required'  => 'telephone is required',
            'telephone.integer'  => 'telephone is integer',
        ];
    }
}